﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using Abp.Application.Services;
using FwProject.Distribution.Dto;
using FwProject.Core.SettlementInfoModel;
using FwProject.Settlement.Dto;
using Microsoft.AspNetCore.Mvc;
using X.PagedList;
using FwProject.Core.Restaurant;

namespace FwProject.Settlement
{
    public interface ISettlementInfoAppService : IApplicationService
    {
        /// <summary>
        /// 添加一条结账信息
        /// </summary>
        /// <returns>The create.</returns>
        /// <param name="input">Input.</param>
        Task<Guid> Create(SettlementInfoInput input);

        Task Check(Guid id, SettlementInfoInput input);

        Task AntiCheck(Guid id);

        Task DeleteSettlement(Guid[] ids);
        /// <summary>
        /// 批量修改
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        Task EditRestaurantPayStatus(List<Guid> id);
        /// <summary>
        /// 修改结账信息
        /// </summary>
        /// <returns>The create.</returns>
        /// <param name="input">Input.</param>
        Task Update(Guid id, SettlementInfoInput input);

        Task UpdateStatus(Guid id);

        Task UpdateDiscountprice(Guid id, decimal discountprice);
        /// <summary>
        /// 返回结账信息
        /// </summary>
        /// <returns>The by identifier async.</returns>
        /// <param name="id">Identifier.</param>
        [HttpGet]
        SettlementInfoDto GetById(Guid id);

        List<SettlementInfoPrintDto> GetListById(List<Guid> ids);


        Task<List<SettlementInfoDto>> GetSettlementInfoByReceiptInfoIdAsync(Guid receiptInfoId);

        /// <summary>
        /// 根据餐厅Id获取收据信息
        /// </summary>
        /// <param name="restaurantId">餐厅Id</param>
        /// <returns></returns>
        Task<List<SettlementInfoDto>> GetSettlementInfoByRestaurantIdAsync(Guid restaurantId);
        /// <summary>
        /// 返回结账列表
        /// </summary>
        /// <returns>The paged list async.</returns>
        /// <param name="page">Page.</param>
        /// <param name="pageseiz">Pageseiz.</param>
        /// <param name="begin">Begin.</param>
        /// <param name="end">End.</param>
        [HttpGet]
        Task<IPagedList<SettlementAppToBInfoDto>> GetPagedListAsync(int pageIdx, int pageSize, RestaurantPayStatus? restaurantPayStatus, Guid? Restaurant, DateTime? begin, DateTime? end);

        Task<SettlementReceivableDto> GetBySettlementIdAsync(Guid SettlementId);
        /// <summary>
        /// 查询收款单
        /// </summary>
        /// <param name="pageIdx"></param>
        /// <param name="pageSize"></param>
        /// <param name="beginTime"></param>
        /// <param name="endTime"></param>
        /// <returns></returns>
        Task<IPagedList<SettlementReceivableDto>> GetReceivablePagedListAsync(int pageIdx, int pageSize, DateTime? beginTime, DateTime? endTime, DateTime? beginDate, DateTime? endDate, string restaurantName,long? driverId, Core.SettlementInfoModel.ExamineStatus? ExamineStatus, RestaurantPayStatus? RestaurantPayStatus, Guid? Line);
        /// <summary>
        /// 收据查询导出
        /// </summary>
        /// <returns></returns>
        Task<List<SettlementReceivableDto>> GetExportReceivableListAsync(DateTime? beginTime, DateTime? endTime, string restaurantName, long? driverId, Core.SettlementInfoModel.ExamineStatus? ExamineStatus, RestaurantPayStatus? restaurantPayStatus, Guid? Line);


        /// <summary>
        /// App未收款查询
        /// </summary>
        /// <param name="pageIdx"></param>
        /// <param name="pageSize"></param>
        /// <param name="RestaurantId"></param>
        /// <param name="begin"></param>
        /// <param name="end"></param>
        /// <returns></returns>
        Task<IPagedList<SettlementInfoDto>> GetPayeeSelfListAsync(int pageIdx, int pageSize, string Restaurantname, DateTime? begin, DateTime? end);

        /// <summary>
        /// App已收款数据
        /// </summary>
        /// <param name="pageIdx"></param>
        /// <param name="pageSize"></param>
        /// <param name="RestaurantId"></param>
        /// <param name="begin"></param>
        /// <param name="end"></param>
        /// <returns></returns>
        Task<IPagedList<SettlementInfoDto>> GetPayeeSelfEnterPayListAsync(int pageIdx, int pageSize, string RestaurantId, DateTime? begin, DateTime? end);

        /// <summary>
        /// 更新收据
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        Task ModifyAsync(ModifyReceiptDto input);


        /// <summary>
        /// 根据餐厅编号返回该餐厅的预收金额
        /// </summary>
        /// <param name="RestaurantId"></param>
        /// <returns></returns>
        Task<Tuple<decimal, decimal>> GetAllSettlementPrice(Guid RestaurantId);

        /// <summary>
        /// 查询所有的缴款(分页)
        /// </summary>
        /// <param name="page"></param>
        /// <param name="pageSize"></param>
        /// <param name="name"></param>
        /// <returns></returns>
        Task<IPagedList<SettlementInfoPrePaymentInfo>> GetAllPaymentInfo(int page, int pageSize, long? id);

        Task<List<SettlementInfoPrePaymentInfo>> GetAllPaymentInfoListAsync(long? id);

        Task<IPagedList<SettlementInfoDto>> GetAssignReceiptListAsync(int pageIdx, int pageSize, long? DriverId, Guid? Line, DateTime? beginTime, DateTime? endTime, BalanceCycleEnum? BalanceCycleEnum, RestaurantPayStatus? RestaurantPayStatus, string AssignmentStatus, string keywords);

        Task AssignReceiptAsync(string Ids, long Cashier);
        /// <summary>
        /// 快速收款列表
        /// </summary>
        /// <param name="pageIdx"></param>
        /// <param name="pageSize"></param>
        /// <returns></returns>
        Task<IPagedList<ReceiptFastlyDto>> GetReceiptFastlyListAsync(int pageIdx, int pageSize, string restaurantName, BalanceWayEnum? balanceWay, BalanceCycleEnum? balanceCycle, Guid? Line, long? DriverId);

        /// <summary>
        /// 获取应收明细
        /// </summary>
        /// <returns></returns>
        Task<IPagedList<SettlementInfoDto>> GetReceivableDetailsAsync(int pageIdx, int pageSize, Guid restaurantId, DateTime? beginTime, DateTime? endTime);

        /// <summary>
        /// 获取单据信息
        /// </summary>
        Task<List<MakingReceiptOutputDto>> GetSettlementListAsync(string Ids);

        /// <summary>
        /// 批量审批
        /// </summary>
        /// <param name="ids"></param>
        /// <returns></returns>
        Task BatchReview(string ids);
        /// <summary>
        /// 分配收据导出
        /// </summary>
        /// <returns></returns>
        Task<List<SettlementExportDto>> GetExportAssignReceiptListAsync(long? DriverId, Guid? Line, DateTime? beginTime, DateTime? endTime, BalanceCycleEnum? BalanceCycleEnum, RestaurantPayStatus? RestaurantPayStatus, string AssignmentStatus, string keywords);
    }
}
